﻿using Face8280WebSocketServer.DB.Log;
using Face8280WebSocketServer.Interface;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Face8280WebSocketServer.Service
{
    public class FaceIOLogService : BaseService, IFaceIOLogService
    {
        public FaceIOLogService(DbContext context) : base(context)
        {

        }

        public void AddIOLog(FaceIOLog log)
        {
            if (log.Id > 0)
            {
                log.Id = 0;
            }
            log.CreateTime = DateTime.Now;
            Insert(log);
        }

        public void ClearLog()
        {
            Excute("Delete from FaceIOLog");
            AddUserLog("通讯日志", "清空通讯日志");
            Commit();
        }
    }
}
